'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH GETAUID 2 "Mar 6, 2017"
.SH NAME
getauid, setauid \- get or set user audit identity
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lbsm\fR \fB -lsocket \fR \fB -lnsl \fR  [ \fIlibrary\fR ... ]
#include <sys/param.h>
#include <bsm/libbsm.h>

\fBint\fR \fBgetauid\fR(\fBau_id_t *\fR\fIauid\fR);
.fi

.LP
.nf
\fBint\fR \fBsetauid\fR(\fBau_id_t *\fR\fIauid\fR);
.fi

.SH DESCRIPTION
.LP
The \fBgetauid()\fR function returns the audit user \fBID\fR for the current
process. This value is initially set at login time and inherited by all child
processes. This value does not change when the real/effective user \fBIDs\fR
change, so it can be used to identify the logged-in user even when running a
setuid program. The audit user \fBID\fR governs audit decisions for a process.
.sp
.LP
The \fBsetauid()\fR function sets the audit user \fBID\fR for the current
process.
.SH RETURN VALUES
.LP
Upon successful completion, the \fBgetauid()\fR function returns the audit user
\fBID\fR of the current process on success. Otherwise, it returns \fB\(mi1\fR
and sets \fBerrno\fR to indicate the error.
.sp
.LP
Upon successful completion the \fBsetauid()\fR function returns \fB0\fR.
Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the
error.
.SH ERRORS
.LP
The \fBgetauid()\fR and \fBsetauid()\fR functions will fail if:
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
The \fIauid\fR argument points to an invalid address.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
The {\fBPRIV_SYS_AUDIT\fR} privilege is not asserted in the effective set of
the calling process.
.RE

.sp
.LP
The \fBgetauid()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 9n
The {\fBPRIV_PROC_AUDIT\fR} privilege is not asserted in the effective set of
the calling process.
.RE

.SH USAGE
.LP
Only a process with appropriate privileges can successfully execute these
calls.
.SH SEE ALSO
.LP
.BR audit (2),
.BR getaudit (2),
.BR privileges (7)
.SH NOTES
.LP
These functions have been superseded by \fBgetaudit\fR(2) and \fBsetaudit()\fR.
